package com.epu.itepu;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;

import com.epu.itepu.adapters.PhotoPagerAdapter;
import com.epu.itepu.helper.Variables;

public class PhotoActivity extends Activity {

	/** Called when the activity is first created. */
	private ViewPager viewPager = null;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_photo);

		viewPager = (ViewPager) findViewById(R.id.view_pager);
		viewPager.setAdapter(Variables.photoPagerAdapter = new PhotoPagerAdapter(getApplicationContext()));
		
		viewPager.setOnPageChangeListener(new OnPageChangeListener() {
			
			@Override
			public void onPageSelected(int position) {
				Variables.currentIndex = position;
			}
			
			@Override
			public void onPageScrolled(int arg0, float arg1, int arg2) {
				// TODO Auto-generated method stub
			}
			
			@Override
			public void onPageScrollStateChanged(int arg0) {
				// TODO Auto-generated method stub
				
			}
		});
	}
	
	public void setView(){
		viewPager.setCurrentItem(Variables.currentIndex);
	}

}
